package br.com.salao.bean;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.codehaus.jackson.annotate.JsonIgnore;

@Entity
@Table(name="estabelecimento")
public class Estabelecimento implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;
	@Column(name = "razao_social", length = 100)
	private String razaoSocial;
	@Column(name = "nome_fantasia", length = 100)
	private String nomeFantasia;	
	@Column(length = 20)
	private String cnpj;
	@OneToOne
	private Endereco endereco;
	@ManyToOne
	@JoinColumn(name = "usuarioResponsavel", nullable = false)
	private Usuario usuarioResponsavel; 
	@Column(length = 2)
	private String ddd;
	@Column(length = 10)
	private String telefone;
	private boolean isEstabelecimentoAtivo = true;
	
	@Temporal(TemporalType.DATE)
	private Date created = new Date();
	
	public Estabelecimento(){
		endereco = new Endereco();
		usuarioResponsavel = new Usuario();
	}
	
	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public String getRazaoSocial() {
		return razaoSocial;
	}
	
	public void setRazaoSocial(String razaoSocial) {
		this.razaoSocial = razaoSocial;
	}
	
	public String getCnpj() {
		return cnpj;
	}

	public void setCnpj(String cnpj) {
		this.cnpj = cnpj;
	}

	public Endereco getEndereco() {
		return endereco;
	}
	
	public void setEndereco(Endereco endereco) {
		this.endereco = endereco;
	}

	public String getNomeFantasia() {
		return nomeFantasia;
	}

	public void setNomeFantasia(String nomeFantasia) {
		this.nomeFantasia = nomeFantasia;
	}

	@JsonIgnore
	public Usuario getUsuarioResponsavel() {
		return usuarioResponsavel;
	}

	public void setUsuarioResponsavel(Usuario usuarioResponsavel) {
		this.usuarioResponsavel = usuarioResponsavel;
	}

	public boolean isEstabelecimentoAtivo() {
		return isEstabelecimentoAtivo;
	}

	public void setEstabelecimentoAtivo(boolean isEstabelecimentoAtivo) {
		this.isEstabelecimentoAtivo = isEstabelecimentoAtivo;
	}

	public String getTelefone() {
		return telefone;
	}

	public void setTelefone(String telefone) {
		this.telefone = telefone;
	}

	public String getDdd() {
		return ddd;
	}

	public void setDdd(String ddd) {
		this.ddd = ddd;
	}	
	
}

